class CuteCat:
    def __init__(self, cat_name, cat_age, cat_color):
        self.name = cat_name
        self.age = cat_age
        self.color = cat_color

    def speak(self):
        print("喵" * self.age)

    def think(self, content):
        print(f"小猫{self.name}在思考{content}…")


cat1 = CuteCat("Jojo", 2, "橙色")
print(f"小猫{cat1.name}的年龄是{cat1.age}岁，花色是{cat1.color}")
cat1.speak()
cat1.think("现在去抓沙发还是去撕纸箱")
print("\n")


# 定义一个学生类
# 要求
# 1.属性包括学生姓名、学号、以及语数英三科的成绩
# 2.能够设置学生某科目的成绩
# 3.能够打印出该学生所有科目成绩

# 自己写的
# class Student:
#     def __init__(self, student_name, student_number, student_chinese, student_math, student_english):
#         self.name = student_name
#         self.number = student_number
#         self.chinese = student_chinese
#         self.math = student_math
#         self.english = student_english
#
#     def print(self):
#         print(
#             f"{self.name}同学，学号{self.number}，语文成绩为{self.chinese}，数学成绩为{self.math}，英语成绩为{self.english}")
#
#
# student1 = Student("小明", "1", "130", "150", "140")
# student1.print()

class Student:
    def __init__(self, name, student_id):
        self.name = name
        self.student_id = student_id
        self.grades = {"语文": 0, "数学": 0, "英语": 0}

    def set_grade(self, course, grade):
        if course in self.grades:
            self.grades[course] = grade

    def print_grades(self):
        print(f"学生{self.name}（学号:{self.student_id}）的成绩为：")
        for course in self.grades:
            print(f"{course}: {self.grades[course]}")


chen = Student("小陈", "100618")
chen.set_grade("语文", 92)
chen.set_grade("数学", 94)
chen.set_grade("英语", 94)
chen.print_grades()
# zeng = Student("小曾", "100622")
# print(chen.name)
# zeng.set_grade("数学", 95)
# print(zeng.grades)
